"use strict"

/**
 * 山东省政府采购网爬虫
 *  
 */

var Base = require("./base");
var sd_spider = new Base();
sd_spider.name = "山东省政府采购网";
sd_spider.encode = "GBK";

sd_spider.getPageUrl = function (pg) {
    var url = "http://www.ccgp-shandong.gov.cn/sdgp2014/site/channelall.jsp?colcode=0301";
    if (pg != 1) {
        url = "http://www.ccgp-shandong.gov.cn/sdgp2014/site/channelall.jsp?curpage=" + pg + "&colcode=0301&subject=&pdate=";
    }
    return url;
};

sd_spider.getItems = function ($) {
    var items = [];
    $(".five").each(function (index, ele) {
        var e = $(ele);
        var item = {};
        item.title = e.text();
        item.url = "http://www.ccgp-shandong.gov.cn" + e.attr("href");
        item.source = sd_spider.name;
        items.push(item);
    });
    return items;
};

exports = module.exports = sd_spider;